package com.uetoken.cn.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.uetoken.cn.R;
import com.uetoken.cn.bean.MeItemBean;
import com.uetoken.cn.utils.GlideApp;
import com.uetoken.cn.utils.GlideUtils;

import java.util.List;

/**
 * @author 谢杨
 * @time 2018/8/22 9:29
 * @class 描述:
 */
public class MeItemAdapter extends BaseQuickAdapter<MeItemBean,BaseViewHolder> {

    public MeItemAdapter(int layoutResId, @Nullable List<MeItemBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MeItemBean item) {
        GlideApp.with(mContext).load(item.getLogo()).apply(GlideUtils.getOtherOption()).into((ImageView) helper.getView(R.id.iv_item_me));
        helper.setText(R.id.tv_item_me,item.getChName());


        View view = helper.getView(R.id.view_item_me);
        LinearLayout linearLayout = helper.getView(R.id.ll_item_me);

        TextView mTvMessage = helper.getView(R.id.tv_item_me_other_info);
        if (item.getMessage()==0){
            mTvMessage.setVisibility(View.INVISIBLE);
        }else{
            mTvMessage.setVisibility(View.VISIBLE);
        }
        mTvMessage.setText(String.valueOf(item.getMessage()));
        if (item.getFunName().equals("separator")){
            view.setVisibility(View.VISIBLE);
            linearLayout.setVisibility(View.GONE);
        }else{
            view.setVisibility(View.GONE);
            linearLayout.setVisibility(View.VISIBLE);
        }
    }
}
